package com.sun.draw.impl;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.sun.draw.api.IDrawService;
import com.sun.draw.pojo.InstantDrawInfo;
import com.sun.util.DBUtil;
/**
 * 抽奖service实现
* @ClassName: DrawServiceImpl  
* @author sunt  
* @date 2018年1月11日 
* @version V1.0
 */
public class DrawServiceImpl implements IDrawService {

	public List<InstantDrawInfo> queryInstantDrawInfo(String activityCode) throws SQLException {
		List<InstantDrawInfo> drawList = new ArrayList<InstantDrawInfo>();
		String sql = "select * from T_PRIZE_SET t where t.F_ID = ?";
		ResultSet resultSet = DBUtil.Query(sql, new Object[]{activityCode});
		
		InstantDrawInfo drawInfo = null;
		while (resultSet.next()) {
			drawInfo = new InstantDrawInfo();
			drawInfo.setSetId(resultSet.getLong("F_SET_ID"));
			drawInfo.setActivityCode(resultSet.getString("F_ID"));
			drawInfo.setPrizeCount(resultSet.getInt("F_PRIZE_COUNT"));
			drawInfo.setPrizeMoney(new BigDecimal(resultSet.getDouble("F_PRIZE_MONEY")));
			drawInfo.setPrizeNum(resultSet.getString("F_PRIZE_NUM"));
			drawInfo.setPrizeTips(resultSet.getString("F_PRIZE_TIPS"));
			drawInfo.setPrizeName(resultSet.getString("F_PRIZE_NAME"));
			drawInfo.setPrizeProbability(new BigDecimal(resultSet.getDouble("F_PRIZE_PROBABILITY")));
			drawList.add(drawInfo);
		}
		
		return drawList;
	}

}
